package com.alks.function.mapper.procurement;


import com.alks.function.data.dto.procurement.PcPackDetailDto;
import com.alks.function.data.request.procurement.NotOrderMaterialRequest;
import com.alks.function.data.request.procurement.PcPackDetailRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Mapper
public interface PackagOrderingOperationMapper {

    /*指令包材待订购明细-查询*/
    List<PcPackDetailDto> getNotOrderMaterialList(@Param("companyId") String companyId, @Param("request") NotOrderMaterialRequest request);

    /*已订购明细-查询*/
    List<PcPackDetailDto> getOrderedDetailsList(@Param("companyId") String companyId, @Param("request") NotOrderMaterialRequest request);

    /*已订购明细-修改需求日期/单价*/
    int updateReqDateAndUPrice(@Param("companyId") String companyId, @Param("request") PcPackDetailRequest request, @Param("newPrice") BigDecimal newPrice, @Param("newPurDate") Date newPurDate);

    /*已订购明细-批量更新*/
    int updateBatchOrderedDetails(@Param("request") List<PcPackDetailRequest> request);

    /*批量取消订购单*/
    int updateBatchOrderedBeNull(@Param("request") List<PcPackDetailRequest> request);

    /*编辑未订购*/
    int updateBatchNotOrdereDetails(List<PcPackDetailRequest> request);

    /*查某个订购单号的不同物料的数量*/
    List<PcPackDetailDto> getOrderedDetailsGroupList(@Param("companyId") String companyId, @Param("request") NotOrderMaterialRequest r);

    /*该指令的规格和码段*/
    List<PcPackDetailDto> getMtlSpecAndSize(@Param("companyId") String companyId, @Param("purNo") String purNo);

    List<PcPackDetailDto> getMtlSpecAndSize2(@Param("companyId") String companyId, @Param("purNo") String purNo);

    /*不同lotNo对应的总purQTY*/
    List<PcPackDetailDto> getPurQtyByLotNo(@Param("companyId") String companyId, @Param("purNo") String purNo);

    List<PcPackDetailDto> getPurQtyByLotNo2(@Param("companyId") String companyId, @Param("purNo") String purNo);

    /*统计lotNo+mtlName+mtlspec+size1+size2相同的数据的订购数量*/
    List<PcPackDetailDto> getPurQtyByMtlSpec(@Param("companyId") String companyId, @Param("purNo") String purNo);

    List<PcPackDetailDto> getPurQtyByMtlSpec2(@Param("companyId") String companyId, @Param("purNo") String purNo);

    /*不同mtlNo的所有数量*/
    List<PcPackDetailDto> getAllPurQtyByMtlSpec(@Param("companyId") String companyId, @Param("request") NotOrderMaterialRequest r);

    /*待订购明细编辑*/
    int updateNotOrderMaterial(@Param("request") PcPackDetailDto request);

    /*统计LotNo() + MtlNo() + getMtlUnit() + Size1() + Size2()相同的数据*/
    List<PcPackDetailDto> getOrdersByCondition(String companyId, String purNo);

    /*分组查询该指令的MtlName() + getMtlUnit() + Size1() + Size2()相同的数据*/
    List<PcPackDetailDto> getOrdersByCondition2(String companyId, String purNo);

    /*查该订单号所有规格*/
    List<String> getMtlSpec(String companyId, String purNo);
}
